<?php
/*
    功能: 图片上传
*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>图片上传预览-day03</title>
    <link rel="stylesheet" href="static/css/bootstrap.min.css">
    <link rel="stylesheet" href="static/css/style.css">
    <script src="static/js/jquery.min.js"></script>
    <script src="static/js/bootstrap.min.js"></script>

</head>
<body>

<?php

//引入公共头部
require_once 'header.php';
$tips_notice=' 请选择图片';

?>

<div class="container well main my-well">
    
    <!-- <h1 class="text-center">图片上传预览</h1>
    <hr/> -->

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
    
    <div class="form-group">
            <?php
                if (!empty($tips_success)):
            ?>
            <div class="alert alert-danger alert-dismissible" role='alert'>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
               
            <?php
                echo $tips_success;
            ?>            
               
            </div>
            <?php
            endif;
            ?>
            <?php
                if (!empty($tips_error)):
            ?>
             <div class="alert alert-danger alert-dismissible" role='alert'>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <?php
                    echo $tips_error;
                ?>
            </div>
            <?php
                endif;
            ?>
            <?php
                if (!empty($tips_notice)):
            ?>
             <div class="alert alert-warning alert-dismissible" role='alert'>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <?php
                    echo $tips_notice;
                ?>
            </div>
            <?php
                endif;
            ?>
    </div>

    <div class="form-group upload-group">
        <div id="btn-file-select">请选择文件</div>
        <input  id="input-file" type="file" name="myfile[]" multiple accept='.png,.jpg,.gif'>
    </div>

    <div class='form-group'>
        <button class="btn btn-primary btn-block btn-lg">立即上传</button>
    </div>

   
    </form>

    <div class="row">
        <div class="col-sm-6 col-md-4">
            <div class="thumbnail">
                <img src="uploads/1.jpg" alt="...">
            </div>
        </div>
    </div>           

</div>


<?php

//引入公共底部
require_once 'footer.php';

?>

<script>
var btn=document.getElementById('btn-file-select');
var inputFile=document.getElementById('input-file');
btn.onclick=function(){
    inputFile.click();
}
</script>
</body>
</html>